﻿using Sys.Api;
using Sys.Core.Tour;
using Sys.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_tour_travel_Edit : PageBase
{
    public TourTravel model { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request.QueryString["id"];

            if (string.IsNullOrEmpty(id))
            {
                model = new TourTravel();
            }
            else { model = TravelBll.I.GetByKey(id); }
        }
    }

    public string TravelImgs(string id)
    {
        var list = ImageBll.I.GetImages("Travel", id);

        StringBuilder sb = new StringBuilder();

        foreach (var item in list.ToList())
        {
            string url = "../userfiles/travel/default/" + item.Img;

            string img = "<img width='168' height='100' src='" + url + "' />";
            string properties = "url='" + url + "' type='" + (item.IsCover ? "Front" : "Img") + "'";

            string front = string.Empty;

            if (item.IsCover)
            {
                front = "<div class='travel-front icon-pictures'></div>";
            }

            string imgbox = "<div class='travel-img panel-body' " + properties + ">" + img + front + "</div>";

            sb.Append("<div class='travel-imgpadding'>" + imgbox + "</div>");
        }

        return sb.ToString();
    }
}